<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue双向绑定案例</title>
</head>
<body>

<div id="app">
    请输入你想要显示的图片<input type="text" v-model="img_name"><br><br>
    <img v-bind:src="img_src">
</div>

<!--<div id="app">-->
<!--    请输入你想要显示的图片<input type="text" v-model="img_name"><br><br>-->
<!--    <img v-bind:src="img_src">-->
<!--</div>-->

<script src="js/vue.js"></script>
<script>
    let vm = new Vue({
        el: "#app",
        data: {
            img_prefix: "images/",
            img_name: "1.jpg"
        },
        computed: {
            img_src() {
                return this.img_prefix + this.img_name;
            }
        }
    });
</script>

<script src="js/vue.js"></script>
<script>
    let vm = new Vue({
        el:"#app",
        data:{
            img_prefix:"images/",
            img_name:"1.jpg",
        },
        computed:{
            img_src(){
                return this.img_prefix + this.img_name;
            }
        }
    })
</script>

</body>
</html>